package com.jysz.certificate.persistence.model.pm;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.jysz.certificate.persistence.enums.pm.PmUserStype;
import com.jysz.certificate.persistence.model.system.User;
import com.jysz.webcore.ssh.entity.AbstractBaseEntity;

@Entity
@Table(name = "pm_user_")
@org.hibernate.annotations.Entity
public class PmUser  extends AbstractBaseEntity<Long>  {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private User author;//提交人
	private Date deliveryTime;//发布时间
	private String deliceryMM;//发布月份
	private List<PmUserList> users;//包含人员
	private PmUserStype state;//状态
	private String area;//区域
	private Boolean mark;//标示此条记录是否为自动生成的  true-填写  false-自动生成
	private PerformanceAssign performanceAssign;
	
	@Column(name = "_mark",columnDefinition="tinyint(1)")
	public Boolean getMark() {
		return mark;
	}
	public void setMark(Boolean mark) {
		this.mark = mark;
	}
	
	@Column(name = "_deliceryMM",columnDefinition="varchar(255)")
	public String getDeliceryMM() {
		return deliceryMM;
	}
	public void setDeliceryMM(String deliceryMM) {
		this.deliceryMM = deliceryMM;
	}
	@OneToMany(targetEntity = PmUserList.class, cascade = { CascadeType.ALL }, mappedBy = "pmUser")  
	public List<PmUserList> getUsers() {
		return users;
	}
	public void setUsers(List<PmUserList> users) {
		this.users = users;
	}
	@ManyToOne(fetch = FetchType.LAZY)  
	@JoinColumn(name = "_user_id",columnDefinition="bigint(20)") 
	public User getAuthor() {
		return author;
	}
	@Column(name = "_deliveryTime")
	public Date getDeliveryTime() {
		return deliveryTime;
	}
	@Column(name = "_area",columnDefinition="varchar(255)")
	public String getArea() {
		return area;
	}
	@Column(name = "_state",columnDefinition="int(11)")
	@Enumerated(EnumType.ORDINAL)
	public PmUserStype getState() {
		return state;
	}
	
	
	public void setAuthor(User author) {
		this.author = author;
	}
	public void setDeliveryTime(Date deliveryTime) {
		this.deliveryTime = deliveryTime;
	}
	
	public void setState(PmUserStype state) {
		this.state = state;
	}
	
	public void setArea(String area) {
		this.area = area;
	}
	
	
	@ManyToOne(fetch = FetchType.LAZY)  
	@JoinColumn(name = "_performance_assign_id", columnDefinition="bigint(20)")
	public PerformanceAssign getPerformanceAssign() {
		return performanceAssign;
	}
	public void setPerformanceAssign(PerformanceAssign performanceAssign) {
		this.performanceAssign = performanceAssign;
	}
}
